home *** CD-ROM | disk | FTP | other *** search
- Path: rcp6.elan.af.mil!rscernix!danpop
- From: danpop@mail.cern.ch (Dan Pop)
- Newsgroups: comp.lang.c
- Subject: Re: What's your compiler's answer?
- Date: 16 Feb 96 00:55:13 GMT
- Organization: CERN European Lab for Particle Physics
- Message-ID: <danpop.824432113@rscernix>
- References: <1996Feb7.140945.28351@cs.rit.edu> <4fq0cq$h9s@hpbblb.bbn.hp.com>
- NNTP-Posting-Host: ues5.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
-
- In <4fq0cq$h9s@hpbblb.bbn.hp.com> Matthias Dittrich <matti> writes:
-
- >I don't know, what sense it makes to gather results of a program with
- >undefined behaviour (more than one inc or dec operator in one expression).
-
- You can have as many ++ or -- operators as you like in an expression,
- as long as they are not applied to the same object without any intervening
- sequence points.
-
- The following examples are legal:
-
- while (*p++ = *q++); /* the typical implementation of strcpy */
- j = i++, i++, i++; /* equivalent to: j = i + 2; i += 3; */
-
- These are notoriously illegal:
-
- i = i++; /* demons fly out of your nose */
- printf("%d\n", i++ * ++i); /* can you hear your disk being reformatted? */
-
- If you have any objections to any of these examples, please read the FAQ
- before expressing them in the newsgroup.
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-